# Contributor: Eli Schwartz <eschwartz@archlinux.org>

_pkgname=hotdoc
pkgname=hotdoc
pkgver=0.15
pkgrel=1
pkgdesc="the tastiest API documentation system"
arch=('loong64' 'x86_64')
url="https://github.com/${_pkgname}/${_pkgname}"
license=('LGPL')
_py_deps=('appdirs' 'dbus-deviation' 'faust-cchardet' 'lxml' 'networkx'
          'pkgconfig' 'schema' 'toposort' 'wheezy-template' 'yaml' 'feedgen')
depends=("${_py_deps[@]/#/python-}" 'json-glib')
makedepends=('python-setuptools' 'python-build' 'python-installer'
             'python-wheel' 'cmake')
optdepends=('clang: for the C extension'
            'llvm: for the C extension')
source=("https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/${_pkgname}/${_pkgname}-${pkgver}.tar.gz"
         https://github.com/hotdoc/hotdoc/commit/8842d813.patch)
sha256sums=('b1f43f88177567e62a9da3a0f23df6ac2da2b9c76288add37dff4d7d81674327'
            '30c16a6e20e26451799d26c144123a5fffaaa0cf829350bbb6439459c6a8db1e')
b2sums=('c3dae1e96fdb68d689a9ab971c84def33ce2c2fd364ebc04110ade3693cf0320c0abcf5ea9861ca05e158e739f0a03302542b15af116fd64660a516ee2be2edb'
        '11fd39389a4acec484eb52e21aa44d3d55d8b8b486b243c0b81e0f36269bf37133f10c4c10b4b36f7e06926e8fc7d30ca4e802d5151f37256bde2775b5ba0039')

prepare() {
  cd $pkgname-$pkgver
  patch -p1 -i ../8842d813.patch # Fix tests
}

build() {
    cd ${pkgname}-${pkgver}

    python -m build --wheel --no-isolation
}

check() {
    cd ${pkgname}-${pkgver}/build/lib.linux-$CARCH-cpython-*

    python -m unittest
}

package() {
    cd ${pkgname}-${pkgver}

    python -m installer --destdir="${pkgdir}" dist/*.whl
}
